<template>
    <div>
       <HomePagetop :list="list"></HomePagetop>
       <div class="upLoadImg">
         <van-uploader 
         v-model="fileList" 
         :after-read="afterRead"
         multiple :max-count="3" />
         <h3>请添加文章头图</h3>
         <p>大小在8M以内，最小尺寸为640*360像素</p>
      </div>
      <div class="upLoadtitle">
        <input type="text" v-model="value" placeholder="标题（建议30字以内）" @input="inputHandler">
      </div>
      <div class="num_list">
         <van-field
          v-model="message"
         
          rows="4"
          autosize
          type="textarea"
          maxlength="100"
          placeholder="请输入正文"
          @input="messageHander"
          show-word-limit
        />
      </div>
      
    </div>
</template>
<script>
import HomePagetop from '@/components/homePage_top'
import moment from 'moment'
import Vue from 'vue';
import { Uploader,Field } from 'vant';
Vue.use(Uploader);
Vue.use(Field);
export default {
    data() {
      return{
        value:"",
        numi:0,
        message:"",
        nowDate:new Date().getTime(),
        list:{
          hp_top:true,
          i_cont:"&#xe62f;",
          user_name:"我要投搞",
          uploadListA:null,
        },
        fileList:[],
        uploadList:{
            u_id:1001,
            active_id:10013,
            active_imgage:"/images/1.jpg",
            active_time:"2018-5-20",
            active_name:"",
            active_minute:"10:56:56",
            active_content:"",
            active_img:[],
            active_zan:0,
            active_pinglun:[
                {
                    u_id:1009,
                    u_name:"阿银",
                    u_img:"@/src/assets/images/1.jpg",
                    pinglun_day:"昨天",
                    pinglun_time:"23：19",
                    pinglun_zan:12
                }
            ],
            active_zhanfa:0,
            active_state:0
        }
      }
    },
    components:{
      HomePagetop
    },
    created(){
        // 转换时间格式年月日时分秒
        // this.nowDate = moment(new Date().getTime()).format('YYYY-MM-DD')
        // let a=moment(new Date().getTime()).format('HH:mm')
        // console.log(this.nowDate,"------",a);
        this.list.uploadListA=this.uploadList
    },
    methods:{
      afterRead(file) {
        // console.log(this.fileList);
        let upLoade_content=this.fileList[this.numi].content;
        // console.log(upLoade_content);
        // this.uploadList.active_img=[
        //   ...this.uploadList.active_img,
        //   ...upLoade_content
        // ];
        this.uploadList.active_img.push(upLoade_content);
        this.numi++;
        // console.log(this.uploadList.active_img);
    },
    inputHandler(a){
      if(this.value!=""){
        this.uploadList.active_name=this.value
      }
    },
     messageHander(){
       if(this.message!=""){
        this.uploadList.active_content=this.message
      }
     }
    }
}
</script>
<style lang="stylus" scoped>
@import '../../../assets/stylus/border.styl'
.upLoadImg
  background-color #fafafa
  text-align center
  padding-top .12rem
  h3 
    padding-top .12rem
  p
    padding .12rem 0
.upLoadtitle
  width 92%
  margin-left 4%
  padding .1rem 0 .08rem 0
  border_1px(0 0 1px 0)
  input 
    display inline-block
    border none
    padding .1rem
    font-size .18rem


</style>